<?php

namespace App\Listeners;

use App\Events\OrderRefundFinished;
use App\Jobs\OrderNotice;
use App\Tool\NoticeType;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class OrderRefundFinishedSmsNotification
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  OrderRefundFinished  $event
     * @return void
     */
    public function handle(OrderRefundFinished $event)
    {
        $status=$event->status;

        $msg='';

        switch ($status){

            case 1:

                $msg='退款';
                break;

            case 2:
                $msg='驳回';
                break;


        }


        //
        dispatch(new OrderNotice(NoticeType::order_refund_finished_notice,['order'=>$event->orderItem->order_no,'status'=>$msg],$event->userItem->phone));


    }
}
